
MgHUD_Armor = 
{
    userData = {}
}
registerWidget("MgHUD_Armor");


function MgHUD_Armor:draw()

    ------ Early out if HUD shouldn't be shown. ------
    if not shouldShowHUD() then return end
	if isRaceMode() then return end

    ------ GET PLAYER ------
    local player = getPlayer();
    local armor = player.armor

    ------ COLORS ------
    local armorColor;
    if player.armorProtection == 2 then armorColor = Color(255,0,0) end
    if player.armorProtection == 1 then armorColor = Color(255,255,0) end
    if player.armorProtection == 0 then armorColor = Color(0,255,0) end
    if player.armor <= 0 then armorColor = Color(120,120,120) end

    ------ DRAW TEXT ------
    nvgFontSize(80);
    nvgFontFace("CodeProLC");
    nvgTextAlign(NVG_ALIGN_RIGHT, NVG_ALIGN_TOP);

    nvgFillColor(Color(48,48,48));
    nvgText(2.46, 1.23, armor);
    nvgFillColor(armorColor);
    nvgText(0, 0, armor);

end
